Advanced React component composition
#Composition #Compoundコンポーネント #React
Advanced React component composition
Reach UIのTabsを例とした、React > ContextやCompoundコンポーネントパターンの使い方の紹介
Recap
We covered a lot of ground in this guide. Let’s finish by recapping the guiding principles for breaking down components and designing composition-based APIs:
Stable dependency principle: Is about creating APIs and components with the end user always in mind. We want to depend on things unlikely to change and hide the messy parts.
Single responsibility principle: Is about encapsulating a single concern. Easier to test, maintain and importantly - compose.
Inversion of control: Is about giving up the idea we can foresee every future use case and empower consumers to plug in their own stuff.
#安定依存の原則(SDP)
#Solid原則
#制御の反転(IoC)
関連: React components composition: how to get it right